package reflect;

import javax.crypto.spec.PSource;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Scanner;

public class ReFlectDemo1 {
    public static void main(String[] args) throws ClassNotFoundException {


//        Class cls = ArrayList.class;
//        Class cls = Class.forName("java.lang.String");

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个类名：");
        String className = scanner.nextLine();
        Class cls = Class.forName(className);


        String name = cls.getName();

        System.out.println(name);
        name = cls.getSimpleName();
        System.out.println(name);

        Package pack = cls.getPackage();
        System.out.println(pack.getName());

        Method[] methods = cls.getMethods();
        System.out.println("一共有" + methods.length + "个方法");
        for (Method method: methods){
            System.out.println(method.getName());
        }



    }











}
